import { Component, OnInit } from '@angular/core';

import { Hero } from './Hero';
import { HeroServcie } from './hero.service';


@Component({
    moduleId: module.id,
    selector: 'my-Dashboard',
    templateUrl: './dashboard.component.html',
    styleUrls : ['./dashboard.component.css']
})

export class DashboardComponent implements OnInit {

    heroes: Hero[] = [];

    constructor(private heroService: HeroServcie) { };

    ngOnInit() {
        //Add 'implements OnInit' to the class.
        this.heroService.getHeros()
            .then(heroes => this.heroes = heroes.slice(1, 5));
    }

}